"""
__author__ = '霍格沃兹测试开发学社'
__desc__ = '更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860'
"""
import time

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

from litemall.pages.base_page import BasePage

"""
商品列表页
"""


class ProductListPage(BasePage):
    _TEXT_PRODUCT_NAME = (By.XPATH, "//tbody/tr[1]/td[3]/div")

    def get_product_name(self):
        # 获取第一个商品名称
        time.sleep(3)
        element = WebDriverWait(self.driver, 10).until(EC.visibility_of_element_located(self._TEXT_PRODUCT_NAME))
        name = element.text
        # 返回第一个商品名称
        return name
